<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ary</title>
</head>

<body>
    <div>打开浏览器控制台查看结果</div>
    <script>
        const ary =
            (fn, n) =>
                (...args) =>
                    fn(...args.slice(0, n));
        const firstTwoMax = ary(Math.max, 2);
        console.log([[2, 6, 'a'], [6, 4, 8], [10]].map(x => firstTwoMax(...x)));;
    </script>
</body>

</html>